<%@ page language="java" contentType="text/html; charset=utf8"
	pageEncoding="utf8"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf8">
	<title><spring:message code="label.titlePreOrder" /></title>
</head>
<body>

<a href="<c:url value="/logout" />">
	<spring:message code="label.logout" />
</a>
  
<h2><spring:message code="label.titlePreOrder" /></h2>

<form:form method="post" action="addPreOrder" commandName="preorder">
	<table>
		<tr>
			<td><form:label path="sn">
				<spring:message code="label.sn" />
			</form:label></td>
			<td><form:input path="sn" /></td>
		</tr>
		<tr>
			<td><form:label path="color">
				<spring:message code="label.color" />
			</form:label></td>
			<td><form:input path="color" /></td>
		</tr>
		<tr>
			<td><form:label path="sizeProd">
				<spring:message code="label.size" />
			</form:label></td>
			<td><form:input path="sizeProd" /></td>
		</tr>
		<tr>
			<td><form:label path="priceProd">
				<spring:message code="label.price" />
			</form:label></td>
			<td><form:input path="priceProd" /></td>
		</tr>
		<tr>
			<td><form:label path="urlProd">
				<spring:message code="label.url" />
			</form:label></td>
			<td><form:input path="urlProd" /></td>
		</tr>				
		<tr>
			<td colspan="2"><input type="submit"
				value="<spring:message code="label.add"/>" /></td>
		</tr>
	</table>
</form:form>

<h3><spring:message code="label.preorders" /></h3>
<c:if test="${!empty preorderList}">
	<table class="data" style="border: 1px solid; border-width:1px;">
		<tr>
			<th><spring:message code="label.userId" /></th>
			<th><spring:message code="label.sn" /></th>
			<th><spring:message code="label.color" /></th>
			<th><spring:message code="label.sizeProd" /></th>	
			<th><spring:message code="label.priceProd" /></th>
			<th><spring:message code="label.urlProd" /></th>	
			<th><spring:message code="label.preOrderStatus" /></th>												
			<th>&nbsp;</th>
		</tr>
		<c:forEach items="${preorderList}" var="preorder">
			<tr>
				<td>${preorder.userId}</td>			
				<td>${preorder.sn}</td>
				<td>${preorder.color}</td>
				<td>${preorder.sizeProd}</td>
				<td>${preorder.priceProd}</td>
				<td>${preorder.urlProd}</td>	
				<td>${preorder.preOrderStatus}</td>							
				<td><a href="deletePreOrder/${preorder.id}"><spring:message code="label.delete" /></a></td>
			</tr>
		</c:forEach>
	</table>
</c:if>

</body>
</html>